 /***************************************************************************
 * Copyright (C) 2012
 * by Dj_Skual
 *
 * This software is provided 'as-is', without any express or implied
 * warranty. In no event will the authors be held liable for any
 * damages arising from the use of this software.
 *
 * Permission is granted to anyone to use this software for any
 * purpose, including commercial applications, and to alter it and
 * redistribute it freely, subject to the following restrictions:
 *
 * 1. The origin of this software must not be misrepresented; you
 * must not claim that you wrote the original software. If you use
 * this software in a product, an acknowledgment in the product
 * documentation would be appreciated but is not required.
 *
 * 2. Altered source versions must be plainly marked as such, and
 * must not be misrepresented as being the original software.
 *
 * 3. This notice may not be removed or altered from any source
 * distribution.
 *
 * TaskBar.hpp
 *
 * for SaveGame Manager GX 2012
 ***************************************************************************/
#ifndef _TASKBAR_HPP_
#define _TASKBAR_HPP_

#include "../Prompts/DeviceMenu.h"
#include "../Gui/gui_pointed.h"

class TaskBar: public GuiFrame, public sigslot::has_slots<>
{
	public:
		static TaskBar * Instance() { if(!instance) instance = new TaskBar(); return instance; }
		static void DestroyInstance() { delete instance; instance = NULL; }
		
		void show();
		void hide();
		
		void UpdateButtons();
		void UpdateSearchButton();
		void UpdateAllButtons();
		
	protected:
		TaskBar();
		virtual ~TaskBar();
		
		static TaskBar * instance;
		
		void OnStateChange(GuiElement *sender, int state, int stateChan);
		void OnButtonStateChange(GuiElement *sender, int state, int stateChan);
		void OnDeviceButtonClick(GuiButton *sender, int pointer, const POINT &p);
		void OnDeviceMenuClick(DeviceMenu * deviceMenu, int dev);
		void OnArrangeButtonClick(GuiButton *sender, int pointer, const POINT &p);
		void OnLockButtonClick(GuiButton *sender, int pointer, const POINT &p);
		void OnSearchButtonClick(GuiButton *sender, int pointer, const POINT &p);
		
		enum
		{
			TASKBAR_SD,
			TASKBAR_USB,
			TASKBAR_WII,
			TASKBAR_EWII,
			TASKBAR_MII,
			TASKBAR_EMII,
			TASKBAR_GCA,
			TASKBAR_GCB,
			TASKBAR_ICON,
			TASKBAR_LIST,
			TASKBAR_LOCKED,
			TASKBAR_UNLOCKED,
			TASKBAR_SEARCH
		};
		
		std::vector<GuiImage *> img;
		std::vector<GuiImage *> imgGray;
		std::vector<GuiImageData *> data;
		std::vector<GuiImageData *> dataGray;
		
		enum
		{
			BTN_DEVICE,
			BTN_DISPLAY,
			BTN_LOCK,
			BTN_SEARCH
		};
		
		std::vector<GuiTooltip *> tooltip;
		std::vector<PictureButton *> button;
		
		GuiPointed * pointed;
		
		GuiSound * btnSoundClick;
		GuiSound * btnSoundOver;
		
		GuiTrigger trigA;
};

#endif